package cn.yitun.chat.yitunserverimcore.general.main.biz.setting.manager;

import cn.yitun.chat.yitunservercommonlib.dataentity.vo.setting.SettingMultipleOnlineStrategyVo;
import cn.yitun.chat.yitunservercommonlib.util.R;
import cn.yitun.chat.yitunserverimbase.dao.setting.SettingMultipleOnlineStrategyDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class MultipleOnlineStrategyManager {

    @Resource
    private SettingMultipleOnlineStrategyDao multipleOnlineStrategyDAO;

    public boolean isMultiple(String type) {
        boolean isMultiple = false;
        List<SettingMultipleOnlineStrategyVo> list = multipleOnlineStrategyDAO.listVO(R.param("type", type));
        List<SettingMultipleOnlineStrategyVo> hasSingleList = new ArrayList<>();
        for (SettingMultipleOnlineStrategyVo m : list) {
            if (0 == m.getIsMultiple()) {
                list.add(m);
            }
        }
        isMultiple = hasSingleList.isEmpty();
        return isMultiple;
    }
}